package com.bisp30;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class MainView extends TabActivity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle("MedoBook");		
		setContentView(R.layout.tabhost);
		Resources res = getResources(); // Resource object to get Drawables
		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Resusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab
		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, BookList.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("booklist").setIndicator("网络书库",res.getDrawable(R.drawable.booklistbtn)).setContent(intent);
		tabHost.addTab(spec);
		
		// Do the same for the other tabs
		intent = new Intent().setClass(this, MyCollectionList.class);
		spec = tabHost.newTabSpec("collectionlist").setIndicator("我的收藏",res.getDrawable(R.drawable.collectionlistbtn)).setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this, BookMark.class);
		spec = tabHost.newTabSpec("searchbook").setIndicator("我的书签",res.getDrawable(R.drawable.bookmarkbtn)).setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this, Setup.class);
		spec = tabHost.newTabSpec("setup").setIndicator("系统设置",res.getDrawable(R.drawable.setupbtn)).setContent(intent);
		tabHost.addTab(spec);
		
		tabHost.setCurrentTab(0);
		
		
	}	
}
